package com.zenith.article.controller;

import com.zenith.article.po.domain.ArtComment;
import com.zenith.article.service.ArtCommentService;
import com.zenith.common.annotation.request.SecurePostMapping;
import com.zenith.common.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 文章评论控制器
 *
 * @author zenith
 * @since 2025-08-29
 */
@RestController
@RequestMapping("/api/article/comment")
@Tag(name = "文章评论管理", description = "文章评论相关接口")
public class ArtCommentController {

    @Autowired
    private ArtCommentService artCommentService;

    /**
     * 创建文章评论
     */
    @Operation(summary = "创建文章评论")
    @SecurePostMapping("/createArtComment")
    public Result<Boolean> createArtComment(@RequestBody ArtComment comment) {
        boolean result = artCommentService.save(comment);
        return Result.success(result);
    }

    /**
     * 删除文章评论
     */
    @Operation(summary = "删除文章评论")
    @SecurePostMapping("/deleteArtComment/{id}")
    public Result<Boolean> deleteArtComment(@PathVariable Long id) {
        boolean result = artCommentService.removeById(id);
        return Result.success(result);
    }
}